package com.my.project.dubbo.user.provider;

import com.my.project.dubbo.user.api.UserService;
import com.my.project.dubbo.user.dal.UserDao;
import com.my.project.dubbo.user.dto.DebitRequest;
import com.my.project.dubbo.user.dto.DebitResponse;
import com.my.project.dubbo.user.dto.UserRequestDto;
import com.my.project.dubbo.user.dto.UserResponseDto;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author:wangbin.
 * @Description.
 * @Date:Created in 13:28 2017/8/21.
 * @Modified By:
 */
@Service("userService")
public class UserServiceImpl implements UserService {
    private static final Logger logger = LoggerFactory.getLogger(UserServiceImpl.class);

    @Autowired
    UserDao userDao;

    public UserResponseDto login(UserRequestDto request) {
        logger.info("模拟用户登陆:request=" + request.toString());

        // 判断用户登陆逻辑

        UserResponseDto response = new UserResponseDto();
        response.setCode("000000");
        response.setMessage("登陆成功");

        return response;
    }

    public DebitResponse debit(DebitRequest debitRequest) {
        DebitResponse response = new DebitResponse();

        userDao.updateUser();

        response.setCode("000000");
        response.setMessage("扣减余额成功");


        return response;
    }
}
